#!/bin/bash

#set -x

JAVAPATH="/opt/IBMJava2-131/jre/bin/"
x=`type -p java 2>/dev/null`
if [ "$x" != "" ]
then
  JAVAPATH=`/usr/bin/dirname $x`
fi
##  This is a script to run the License Manager java app.
##  This script is invoked every time the HMC is started.
##  If the user accepts the terms of the license, the app will 
##  create a file in /opt/hsc/data.  This directory is checked
##  for the existence of that file each time the HMC is
##  started.  
##   

if [ -f /opt/hsc/data/.license_accepted ]
then 
#   echo "License Agreement already signed"
    exit 0
else
#   echo "run License Manager"
    export PATH=$JAVAPATH:$PATH
if [ "${DEBUG_JARS_DIRECTORY}" != "" ] ; then
  if [ -d ${DEBUG_JARS_DIRECTORY} ] ; then
    for i in ${DEBUG_JARS_DIRECTORY}/*.jar
    do
       debug_jars=${debug_jars}:$i
    done
  fi
fi

    export CLASSPATH=${DEBUG_JARS_DIRECTORY}:${debug_jars}:/usr/websm/codebase/pluginjars/hsc.jar:/opt/hsc/data:/usr/websm/codebase/wsm.jar:$CLASSPATH
    java -Xms20m -Xmx128m com.ibm.hsc.common.util.LicenseManager
fi
exit 0
